<%layout("/eova/layout/default.html",{'title' : 'CRUD'}){%>
<script type="text/javascript" src="/eova/template/crud/crud.js"></script>

<body class="easyui-layout">
	<div id="toolbar" style="display: none;">
		<table>
			<tr>
				<td>
					<table>
						<tr>
							<td>
								<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-group_edit',plain:true"
								onclick="alert(2)">
									全选
								</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-group_edit',plain:true"
								onclick="alert(1)">
									反选
								</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-group_edit',plain:true"
								onclick="alert(1)">
									选择所有查询
								</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-group_edit',plain:true"
								onclick="alert(1)">
									选择所有新增
								</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-group_edit',plain:true"
								onclick="alert(1)">
									选择所有删除
								</a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</div>
	<table id="roleMenu" class="easyui-treegrid" data-options="
                url: '/auth/test',
                method: 'get',
                rownumbers: true,
                idField: 'id',
                treeField: 'name',
                fit:true,
                toolbar : '#toolbar'
            ">
        <thead>
            <tr>
            </tr>
        </thead>
    </table>
</body>

<script>
	$(function(){
		$("#roleMenu").datagrid({
			columns:[[
				{ field : 'name',title : '菜单', width : '180' },
				{ field : 'btnName', title : '功能', width : '800',
					formatter:function(value, row, field){
						if(value){
							var names = value.split(",");
							var ids = row['btnId'].split(",");
							var s = "";
							for(i=0; i< names.length; i++){
								s += '<label><input type="checkbox" value="'+ ids[i] +'">' + names[i] + '</label>&nbsp;&nbsp;&nbsp;';
							}
						}
					 	return s;
					}
				}
			]]
		})
	})
</script>

<%}%>